package com.example.plane;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.constraint.ConstraintLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.example.plane.GameView.GameView;

public class MainActivity extends AppCompatActivity {
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ConstraintLayout constraintLayout=(ConstraintLayout)findViewById(R.id.constrainLayout);
//        button.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                Toast.makeText(MainActivity.this, "onLongPress", Toast.LENGTH_LONG).show();
//            }
//        });
          constraintLayout.setOnTouchListener(new View.OnTouchListener() {//对该布局进行触屏监控
            @Override
            public boolean onTouch(View v, MotionEvent event) {
               if(event.getAction()==MotionEvent.ACTION_UP)//判断事件类型是否为按下
                {
                    Intent intent = new Intent(MainActivity.this,GameActivity.class);//打开下一个活动
                    startActivity(intent);
                    finish();
                }
                    return true;
            }
        });
    }

}
